Lost World Vulnerability Mapping

For a given character represented in a .txt file, determine what moves they are vulnerable to For the 4 defence move, how often they get hurt (not hit) Sudo Code Read in the .txt file Parse the line 'damage=' to create determine all the result page that cause damage of 1 or more For all pages, determine if any of the attack moves are in column 4,8,18,20 For each ?your move? (column 4,8, 18, 20) , # do the result pages hit
Aggreggated across all the damaging results page

Example For the name of the File: xxxx.txt Move 8: 5 Move 16: 0 Move 18: 8 Move 20: 7 Additional details Number of damage results pages that cause damage of 1 or more Which pages Hit


In [ ]:
# get the info 
import os 
print(os.getcwd())
path = 'amulf of peth-m.txt'
f = open(path, 'r')

In [ ]:
def howhurt(f, output):
    f = open(path, 'r')
    f.seek(0)
    pages, moves, damagerPages = [], [],[]
    minny = 0      # minimum damanage
    dodge, jumpup, jumpaway, duck = 0,0,0,0
    
    try:
        for line in f:
            temp = line.rstrip()
            if temp[0:6] == 'pages[':
                move = temp[11:-1].split(',')
                moves.append(move)
            elif temp[0] == 'd':
                damage = temp[7:].split('|')
                for index, value in enumerate(damage): 
                    boo = value.split(',')
                    if int(boo[1]) > minny: 
                        damagerPages.append(int(boo[0])) 
        for index, value in enumerate(moves):
            if int(value[3]) in damagerPages:
                dodge += 1 
            if int(value[7]) in damagerPages:
                jumpaway += 1 
            if int(value[8]) in damagerPages:
                jumpup += 1
            if int(value[9]) in damagerPages:
                duck += 1     
        print ('For File: ', path)
        print ('    Dodge     (Move 8)  gets hit: ', dodge)
        print ('    Jump Away (Move 16) gets hit: ', jumpaway)
        print ('    Jump Up   (Move 18) gets hit: ', jumpup)
        print ('    Duke      (Move 20) gets hit: ', duck)
        print ('The following page cause positive damange', damagerPages)

        
        mystr = 'For File: ' + path + '\n'
        mystr = mystr + '    Dodge     (Move 8)  gets hit: ' + str(dodge) + '\n'
        mystr = mystr + '    Jump Away (Move 16) gets hit: ' + str(jumpaway) + '\n'
        mystr = mystr + '    Jump Up   (Move 18) gets hit: ' + str(jumpup) + '\n'
        mystr = mystr + '    Duke      (Move 20) gets hit: ' + str(duck) + '\n'
        output.write(mystr)

    except:
        mystr = '*** There was a problem with ' + path + ' ***\n'
        print(mystr)
        output.write(mystr)
        return()

In [ ]:
# don't run this 
path = 'driataur-m.txt'
howhurt(path, out)

In [ ]:
import glob 
out = open("results.xxx", 'w')
for filename in glob.glob('*.txt'):
    path = filename
    howhurt(path, out)
out.close()

In [ ]: